//796. 旋转字符串
//思路：将字符串s看作一个环形，与goal去匹配

#include <stdbool.h>
#include <string.h>
bool rotateString(char * s, char * goal){
    int len1 = strlen(s);
    int len2 = strlen(goal);
    if(len1 != len2) return false;

    for(int i = 0; i < len1; i++)
    {
        int flag = 1;
        for(int j = 0; j < len2; j++)
        {
            if(s[(i+j) % len2] != goal[j])//关键步骤
            {
                flag = 0;
                break;
            }
        }
        if(flag)
            return true;
    }
    return false;
}